package com.muyu.product.service.impl;

import java.util.List;

import com.muyu.common.core.utils.ObjUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import com.muyu.product.mapper.AsProductAttributeInfoMapper;
import com.muyu.product.domain.AsProductAttributeInfo;
import com.muyu.product.service.AsProductAttributeInfoService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;

/**
 * 商品属性Service业务层处理
 *
 * @author DongZeLiang
 * @date 2024-02-27
 */
@Slf4j
@Service
public class AsProductAttributeInfoServiceImpl extends ServiceImpl<AsProductAttributeInfoMapper, AsProductAttributeInfo>  implements AsProductAttributeInfoService {

    /**
     * 查询商品属性列表
     *
     * @param asProductAttributeInfo 商品属性
     * @return 商品属性
     */
    @Override
    public List<AsProductAttributeInfo> list(AsProductAttributeInfo asProductAttributeInfo) {
        LambdaQueryWrapper<AsProductAttributeInfo> queryWrapper = new LambdaQueryWrapper<>();


        if (ObjUtils.notNull(asProductAttributeInfo.getProductId())){
            queryWrapper.eq(AsProductAttributeInfo::getProductId, asProductAttributeInfo.getProductId());
        }

        if (ObjUtils.notNull(asProductAttributeInfo.getAttributeId())){
            queryWrapper.eq(AsProductAttributeInfo::getAttributeId, asProductAttributeInfo.getAttributeId());
        }

        if (ObjUtils.notNull(asProductAttributeInfo.getValue())){
            queryWrapper.eq(AsProductAttributeInfo::getValue, asProductAttributeInfo.getValue());
        }

        return list(queryWrapper);
    }
}
